from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker,Session
# 初始化数据库连接:
engine = create_engine('sqlite:///test.db', encoding="utf-8", echo=True)
# 创建session对象:
session = sessionmaker(bind=engine)()

def get_dict_list_from_sqlalchemy_result(result):
    list_dict = []
    for i in result:
        i_dict = i._asdict()  # sqlalchemy.util._collections.result , has a method called _asdict()
        list_dict.append(i_dict)
    return list_dict